package com.himaci.gtbattle.model;

import com.himaci.gtbattle.model.character.Archer;
import com.himaci.gtbattle.model.character.Mage;
import com.himaci.gtbattle.model.character.Priest;

/**
 * Kelas player
 *
 * @author XNPSDN
 */
public class Player {

    public static final int PLAYER_ONE = 1;
    public static final int PLAYER_TWO = 2;
    public int id;
    public AI ai;
    public GameChar[] characters;

    /**
     * Konstruktor useless
     */
    public Player() {
	// nothing todo here...
    }

    /**
     * Konstruktor
     * @param id Nomor player
     */
    public Player(int id, int aiLevel) {
	this.id = id;
	this.ai = new AI(this, aiLevel);

	characters = new GameChar[3];
	characters[0] = new Archer(this);
	characters[1] = new Mage(this);
	characters[2] = new Priest(this);
    }

    /**
     * Mengkopi value player
     * @return Player value
     */
    public Player copy() {
	Player retVal = new Player();

	retVal.id = id;
	retVal.ai = null;
	
	retVal.characters = new GameChar[3];
	retVal.characters[0] = characters[0].copy(retVal);
	retVal.characters[1] = characters[1].copy(retVal);
	retVal.characters[2] = characters[2].copy(retVal);

	return retVal;
    }

    /**
     * Update player
     * @param deltaTime Selisih waktu
     */
    public void update(float deltaTime) {
	characters[0].update(deltaTime);
	characters[1].update(deltaTime);
	characters[2].update(deltaTime);
    }
}
